package com.flyfinger.codec;

import java.io.IOException;

/**
 * @author zhouyp
 * @program code
 * @description
 * @create 2020-06-13
 */
public interface Serializer {

	/**
	 * java对象转换为二进制
	 *
	 * @param object object
	 * @return byte[]
	 */
	byte[] serialize(Object object) throws IOException;


	/**
	 * 二进制转换成java对象
	 *
	 * @param clazz clazz
	 * @param bytes bytes
	 * @param <T>   T
	 * @return T
	 */
	<T> T deserialize(Class<T> clazz, byte[] bytes) throws IOException;
}
